www.gusucode.com > 良精ASP微博管理系统 V1.0 > 良精ASP微博管理系统 V1.0\code\admin\admin_adminmanage.asp

    <!--#include file="../Include/liangconn.asp"-->
<!--#include file="../Include/Function.asp"-->
<!--#include file="../Include/CheckLogin.asp"-->
<!--#include file="../Include/Md5.asp"-->
<%
	action 		= request("action")
	act 		= request("act")
	Admin_ID  	= Request("Admin_ID")
	
	Set Rs = Server.CreateObject("ADODB.Recordset")
	
	if action = "add" then
		sql = "Select * from Liangjing_Admin where Admin_LoginName='"&Request("Admin_LoginName")&"'"
		Rs.open Sql,conn,1,2
		if Rs.eof then
			Rs.AddNew
				Rs("Admin_LoginName") 	= Request("Admin_LoginName")
				Rs("Admin_Name") 		= Request("Admin_Name")
				Rs("Admin_Pass") 		= Md5(Request("Admin_Pass"))
				Rs("Admin_IsLock") 		= Request("Admin_IsLock")
				Rs("Admin_AddTIme") 	= Now()
				Rs("Admin_ModifyTime")	= Now()
				Rs("Admin_Operator") 	= Session("_AdminID")
			Rs.Update
		else
			Call Wodig.Msgbox2("管理登陆名存在重复!",0,"javascript:history.back()")
			response.End()
		end if
		if err.number = 0 then
			Response.Redirect("Admin_AdminManage.asp")
			Response.end
		else
			Response.Write(err.description)
		end if
	elseif action = "edit" then
		sql = "Select * from Liangjing_Admin where Admin_ID="&Request("Admin_ID")
		Rs.open Sql,conn,1,2
		if not Rs.eof then
			Rs("Admin_LoginName") 	= Request("Admin_LoginName")
			Rs("Admin_Name") 		= Request("Admin_Name")
			if Request("Admin_Pass") <> "" then
				Rs("Admin_Pass") 	= Md5(Request("Admin_Pass"))
			end if
			Rs("Admin_IsLock") 		= Request("Admin_IsLock")
			Rs("Admin_ModifyTime")	= Now()
			Rs("Admin_Operator") 	= Session("_AdminID")
			Rs.Update
		end if
		if err.number = 0 then
			Response.Redirect("Admin_AdminManage.asp")
			Response.end
		end if	
	elseif action = "del" then
		Sql = "Delete From Liangjing_Admin Where Admin_ID="&Admin_ID
		Conn.execute(Sql)
		Response.Redirect("Admin_AdminManage.asp")
		Response.end
	end if
	
	if act = "edit" then
		Sql = "Select * from Liangjing_Admin Where Admin_ID="&Admin_ID
		Rs.open Sql,conn,1,2
		if not Rs.eof then
			Admin_LoginName = Rs("Admin_LoginName")
			Admin_Name		= Rs("Admin_Name")
			Admin_Pass		= Rs("Admin_Pass")
		end if
		Rs.Close
		Set Rs = Nothing
	end if
	if act = "" then act = "add"
%>

<script language="javascript">
<!--
	function frm_onsubmit(frm){
		var frm = eval(frm);
		if(frm.admin_loginname.value==""){
			alert("登陆名不能为空!");
			frm.admin_loginname.focus();
			return false;
		}
		if(frm.admin_name.value==""){
			alert("管理员的真实姓名不能为空!");
			frm.admin_name.focus();
			return false;
		}
		if(frm.admin_pass.value != ""){
			if(frm.admin_pass.value != frm.admin_pass2.value){
				alert("两次密码不一至!");
				frm.admin_pass.focus();
				return false;
			}
		}
		if(frm.action.value == "add"){
			if(frm.admin_pass.value == ""){
				alert("密码不能为空!");
				frm.admin_pass.focus();
				return false;
			}
			if(frm.admin_pass.value != frm.admin_pass2.value){
				alert("两次密码不一至!");
				frm.admin_pass.focus();
				return false;
			}
		}
		if(confirm("您确定要操作此管理员吗?")){
			return true;
		}
		return false;
	}
	
	function isDel(id){
		if(confirm("您确定要删除此类别吗?")){
			location.href="Admin_AdminManage.asp?Action=del&Admin_ID="+id;
		}
	}
-->
</script>
<link href="images/Admin.css" rel="stylesheet" type="text/css">

<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
      <td>			  
			<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
			  <tr bgcolor="#EAEAEA"> 
			  	<td height="25" align="center">编号</td>
				<td align="center">用户名</td>
				<td align="center">真实姓名</td>
				<td align="center">锁定</td>
				<td align="center">操作</td>
			  </tr>
			  <%			  	
				sql="SELECT * From Liangjing_Admin order by Admin_ID"
				set RS=conn.execute(sql)			  
			  	while not Rs.eof
					IsLock		= "正常" 
					IsTxt 		= "<font color='#ff0000'>×</font>"
					IsMember 	= "<font color='#ff0000'>×</font>"
					IsOnlineBy 	= "<font color='#ff0000'>×</font>"
					IsMedia 	= "<font color='#ff0000'>×</font>"
					IsConfig 	= "<font color='#ff0000'>×</font>"
					
					if Rs("Admin_IsLock") 		= true then IsLock 		= "<font color=#ff0000>锁定</font>"
					if Rs("Admin_IsTxt") 		= true then IsTxt 		= "√"
					if Rs("Admin_IsMember") 	= true then IsMember 	= "√"
					if Rs("Admin_IsOnlineBy") 	= true then IsOnlineBy 	= "√"
					if Rs("Admin_IsMedia") 		= true then IsMedia 	= "√"
					if Rs("Admin_IsConfig") 	= true then IsConfig	= "√"
			  %>
			  <tr<%= Tr_MouseOver %> bgcolor="#FFFFFF"> 
			  	<td height="22" align="center">&nbsp;<%=Rs("Admin_ID")%></td>
				<td align="center">&nbsp;&nbsp;<%=rs("Admin_LoginName")%></td>
				<td align="center"><%=rs("Admin_Name")%></td>
				<td align="center">&nbsp;<%=IsLock%></td>
				<td align="center"> 
					<a href="javascript:isDel(<%=Rs("Admin_ID")%>);">删除</a> 
					<a href="Admin_AdminManage.asp?act=edit&Admin_ID=<%=Rs("Admin_ID")%>">编辑</a>
				</td>
			  </tr>
			  <%
					Rs.MoveNext 
				Wend
			  %>
			</table>
			
			<br>
			
		<form action="Admin_AdminManage.asp" method="post" onSubmit="return frm_onsubmit(this);" name="frmdata">
			<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
				<tr> 
					<td height="28" colspan="2" bgcolor="#EAEAEA">
					<strong>&nbsp;系统管理员</strong></td>
				</tr>
				
				<tr bgcolor="#FFFFFF"> 
					<td width="17%" height="23">&nbsp;&nbsp;登&nbsp;入&nbsp;名:</td>					
					<td width="83%" height="23"><input type="text" name="admin_loginname" size="40" maxlength="40" value="<%=admin_loginname%>"></td>
				</tr>
				
				<tr bgcolor="#FFFFFF"> 
					<td height="23">&nbsp;&nbsp;真实姓名:</td>					
					<td height="23"><input type="text" name="admin_name" size="40" maxlength="50" value="<%=admin_name%>"></td>
				</tr>
				
				<tr bgcolor="#FFFFFF"> 
					<td width="17%" height="23">&nbsp;&nbsp;密&nbsp;&nbsp;&nbsp;&nbsp;码:</td>					
					<td width="83%" height="23"><input type="text" name="admin_pass" size="40" maxlength="40"></td>
				</tr>
				
				<tr bgcolor="#FFFFFF"> 
					<td height="23">&nbsp;&nbsp;密码确认:</td>					
					<td height="23"><input type="text" name="admin_pass2" size="40" maxlength="50"></td>
				</tr>
				
				<tr bgcolor="#FFFFFF"> 
					<td width="17%" height="23">&nbsp;&nbsp;是否锁定:</td>
					<td width="83%" height="23">
						<input type="radio" name="admin_islock" value="0" <% if admin_islock="" or admin_islock=false then Response.Write(" checked") %>>
						正常
						<input type="radio" name="admin_islock" value="1" <% if admin_islock=true then Response.Write(" checked") %>>
						锁定
					</td>
				</tr>
				
		   
				<tr bgcolor="#EAEAEA"> 
					<td height="22" colspan="2" align="center">
						<input type="submit" name="Submit" value=" 提交 ">
						<input type="reset" name="Submit2" value=" 重置 ">
						
						<input type="button" name="button" value="重新添加" onClick="javascript:location.href='Admin_AdminManage.asp';">
					  	<input type="hidden" name="Admin_ID" value="<%=Admin_ID%>">
						<input type="hidden" name="action" value="<%=act%>">
					</td>
				</tr>
			</table>
		</form>	
		
		
	</td>	
	</tr>
	<tr> 
	  <td height="22"><div align="right"></td>
	</tr>
</table>

<%  
Set Rs = Nothing 
Set Conn = Nothing 
%>